//random shuffle algorithm
//depends on the rand func
#include<iostream>
#include<cmath>
#include<cstdlib>
using namespace std;

void rand_shuffle(int*,int);

int main()
{
	int a[] = {3,4,2,1,6,9,8,7};
	rand_shuffle(a,sizeof(a));
	return 0;
}

void rand_shuffle(int* arr, int n_size)
{
	assert(arr&&n_size>0);
	for(int i=0; i < n_size; ++i)
	{
		int off = rand() % (n_size-i);
		int temp = arr[i];
		arr[i] = arr[i+off];
		arr[i+off] = temp;
	}
}
